package com.hxzy.enterprise.service.impl;

import com.hxzy.enterprise.entity.TtVendorContract;
import com.hxzy.enterprise.mapper.TtVendorContractMapper;
import com.hxzy.enterprise.service.TtVendorContractService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author baiyu
 * @since 2023-06-26
 */
@Service
public class TtVendorContractServiceImp extends ServiceImpl<TtVendorContractMapper, TtVendorContract> implements TtVendorContractService {

    @Override
    public List<TtVendorContract> getTtVendorContract() {
        List<TtVendorContract> ttVendorContracts = baseMapper.selectList(null);
        if(ttVendorContracts!=null){
            return ttVendorContracts;
        }
        return null;
    }



    @Override
    public TtVendorContract insterTtVendorContract(TtVendorContract ttVendorContract) {
        int insert = baseMapper.insert(ttVendorContract);
        if(insert>0){
            return ttVendorContract;
        }
        return null;
    }

    @Override
    public int updataTtVendorContract(TtVendorContract ttVendorContract) {
        int i = baseMapper.updateById(ttVendorContract);
        if(i>0){
            return i;
        }
        return 0;
    }

    @Override
    public TtVendorContract getTtVendorContract1(String id) {
        TtVendorContract ttVendorContract = baseMapper.selectById(id);
        if(ttVendorContract!=null){
            return ttVendorContract;
        }
        return null;
    }

    @Override
    public int deletaTtVendorContract(String id) {
        int i = baseMapper.deleteById(id);
        if(i>0){
            return i;
        }
        return 0;
    }
}
